90b76fc8b9855ffad0d453af526f7b4adaa8fa85,src/api/java/com/continuuity/api/flow/FlowletDefinition.java,FlowletDefinition,inspectFlowlet,#Class#Set#Map#Map#,158

Before Change


            types = Sets.newHashSet();
            inputs.put(inputName, types);
          }
          Preconditions.checkArgument(!types.contains(inputType),
                                      "Same type already defined for the same input. Type: %s, input: %s",
                                      inputType, inputName);
          types.add(inputType);
        }
      }

After Change


            types = Sets.newHashSet();
            outputs.put(outputName, types);
          }
          Preconditions.checkArgument(types.add(outputType),
                                      "Same output name cannot have same type; class: %s, field: %s", type, field);
        }
      }

      // Grab all process methods
      for (Method method : type.getRawType().getDeclaredMethods()) {
        // There should be no process method on GeneratorFlowlet
        if (GeneratorFlowlet.class.isAssignableFrom(type.getRawType())) {
          continue;
        }
        Process processAnnotation = method.getAnnotation(Process.class);
        if (!method.getName().startsWith(PROCESS_METHOD_PREFIX) && processAnnotation == null) {
          continue;
        }

        Type[] methodParams = method.getGenericParameterTypes();
        Preconditions.checkArgument(methodParams.length > 0 && methodParams.length <= 2,
                                    "Type parameter missing from process method; class: %s, method: %s",
                                    type, method);

        // If there are more than one parameter, there be exactly two and the 2nd one should be InputContext
        if (methodParams.length == 2) {
          Preconditions.checkArgument(InputContext.class.equals(TypeToken.of(methodParams[1]).getRawType()),
                                      "The second parameter of the process method must be %s type.",
                                      InputContext.class.getName());
        }

        // Extract the Input type from the first parameter of the process method
        Type inputType = type.resolveType(methodParams[0]).getType();

        List<String> inputNames = Lists.newLinkedList();
        if (processAnnotation == null || processAnnotation.value().length == 0) {
          inputNames.add(ANY_INPUT);
        } else {
          Collections.addAll(inputNames, processAnnotation.value());
        }

        for (String inputName : inputNames) {
          Set<Type> types = inputs.get(inputName);
          if (types == null) {
            types = Sets.newHashSet();
            inputs.put(inputName, types);
          }
          Preconditions.checkArgument(types.add(inputType),
                                      "Same type already defined for the same input. Type: %s, input: %s",
                                      inputType, inputName);
        }
      }
    }